<!--
  @author liuying
  @date 2018/11/21 15:36
-->
<!DOCTYPE html SYSTEM "http://www.thymeleaf.org/dtd/xhtml1-strict-thymeleaf-4.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:th="http://www.thymeleaf.org">

<head>
    <title>新增会员订单</title>

    <th:block th:replace="common/common :: jscss"/>

</head>

<body>

<div class="layui-fluid new-order-page">
    <div class="layui-card">
        <form method="post" action="" class="layui-form" lay-filter="zmn-order-add-form">
            <input type="hidden" name="workId" id="work-id"/>
            <input type="hidden" name="orderId"  id="order-id"/>

            <input type="hidden" name="longitude" id="longitude"/>
            <input type="hidden" name="latitude"  id="latitude"/>

            <input type="hidden" name="provinceId"/>
            <input type="hidden" name="cityId"/>
            <input type="hidden" name="countyId"  id="countyId"/>
            <!-- 新单 -->
            <input type="hidden" name="type" id="type" th:value="1"/>
            <!--地址info-->
            <input type="hidden" id="streetSource" name="streetSource" value="0">
            <input type="hidden" id="communityId">
            <!--<div class="layui-card-header" style="margin-top:10px;"><b>基本信息</b></div>-->
            <div class="layui-split">&nbsp;</div>

            <div>
                <!-- 联系电话 -->
                <div class="layui-form-item">
                    <div class="layui-inline">
                        <label class="layui-form-label">联系电话</label>
                        <div class="layui-input-inline" style="width: 200px;">
                            <!-- 联系电话1 -->
                            <th:block th:replace="common/_orderAddTmpl :: inputOfTelephone1ForMember"/>
                        </div>
                        <label class="layui-form-label">联系电话</label>
                        <div class="layui-input-inline" style="width: 200px;">
                            <!-- 联系电话2 -->
                            <input class="layui-input"
                                   id="telephone2"
                                   type="text"
                                   name="telephone2"
                                   lay-verify="tel"
                                   placeholder="电话02"
                                   autocomplete="off" >
                        </div>
                        <div class="layui-input-inline" style="width: 200px;">
                            <!-- 联系电话3 -->
                            <input class="layui-input"
                                   id="telephone3"
                                   type="text"
                                   name="telephone3"
                                   lay-verify="tel"
                                   placeholder="电话03"
                                   autocomplete="off" >
                        </div>
                        <div class="layui-form-mid layui-word-aux"><a id="btn-equity" href="">会员权益 <i class="layui-icon layui-icon-down"></i></a></div>
                    </div>
                </div>
                <!-- 用户姓名、下单渠道 -->
                <div class="layui-form-item">
                    <div class="layui-inline">
                        <label class="layui-form-label layui-form-required">客户姓名</label>
                        <div class="layui-input-inline" style="width: 200px;">
                            <th:block th:replace="common/_orderAddTmpl :: inputOfUserNameForMember"/>
                        </div>
                        <label class="layui-form-label layui-hide">下单渠道</label>
                        <div class="layui-input-inline layui-hide" style="width: 410px;">
                            <select id="channelId" name="channelId" lay-verify="required" lay-filter="channelId" lay-search>
                                <option th:each="channel : ${channelList}"
                                        th:value="${channel.value}"
                                        th:selected="${channel.selected == true}"
                                        th:text="${channel.text}">
                                </option>
                            </select>
                        </div>
                    </div>
                </div>
                <!-- 用户性别 -->
                <div class="layui-form-item">
                    <label class="layui-form-label"></label>
                    <div class="layui-input-block" >
                        <input type="radio"
                               name="gender"
                               th:each="item : ${gender}"
                               th:value="${item.value}"
                               th:title="${item.text}"
                               th:checked="${item.value} == 3"
                               lay-verify="required">
                    </div>
                </div>
                <!-- 服务分类、订单类型 -->
                <div class="layui-form-item">
                    <div class="layui-inline">
                        <label class="layui-form-label">服务分类</label>
                        <div class="layui-input-inline" style="width: 200px;">
                            <select id="servCategoryId" name="servCategId" lay-verify="required" lay-filter="servCategory" lay-search>
                                <option value="">全部</option>
                                <option th:each="item : ${servCategList}"
                                        th:value="${item.value}"
                                        th:text="${item.text}">
                                </option>
                            </select>
                        </div>
                        <label class="layui-form-label" >订单类型</label>
                        <div class="layui-input-inline" style="width: 170px;">
                            <input type="radio"
                                   name="type"
                                   th:each="item : ${type}"
                                   th:value="${item.value}"
                                   th:title="${item.text}"
                                   th:checked="${item.value} == 1"
                                   lay-verify="required"
                                   lay-filter="order-type">
                        </div>
                        <div class="layui-input-inline layui-hide" id="origin-code" style="margin-left: -10px; width: 240px;" >
                            <input class="layui-input"
                                   type="text"
                                   name="reworkId"
                                   placeholder="请填写返修源单号"
                                   autocomplete="off"
                                   lay-verify="rework">
                        </div>
                    </div>
                </div>
                <!-- 服务产品、产品数量、品牌 -->
                <div class="layui-form-item">
                    <div class="layui-inline">
                        <label class="layui-form-label" >服务产品</label>
                        <div class="layui-input-inline" style="width: 200px;">
                            <select class="product-select"
                                    id="product"
                                    name="productId"
                                    lay-verify="required"
                                    lay-filter="product"
                                    lay-search>
                                <option value=""></option>
                            </select>
                        </div>
                        <div class="layui-input-inline layui-hide" style="width: 230px;">
                            <input type="radio"
                                   name="productShowType"
                                   th:each="item : ${productShowType}"
                                   th:value="${item.value}"
                                   th:title="${item.text}"
                                   th:checked="${item.value} == 1"
                                   lay-verify="required"
                                   lay-filter="product-showtype">
                        </div>
                        <label class="layui-form-label" >产品数量</label>
                        <div class="layui-input-inline" style="width: 200px;">
                            <input class="layui-input"
                                    id="count"
                                    type="text"
                                    name="number"
                                    placeholder="请填写数量"
                                    autocomplete="off"
                                    min="1"
                                    max="10"
                                    lay-verify="required|count"
                                    style="padding-right: 40px">
                            <span class="order-number-unit" id="unit"></span>
                        </div>
                        <div class="layui-input-inline" style="width: 200px;">
                            <select id="brand" name="brandId" lay-filter="brand" lay-search>
                                <option value="">品牌</option>
                                <option th:each="item : ${brandList}" th:value="${item.value}" th:text="${item.text}"></option>
                            </select>
                        </div>
                        <div class="layui-form-mid layui-word-aux">权益：<span id="equity-name"></span></div>
                    </div>
                </div>
                <!-- 常见故障 -->
                <div class="layui-form-item" style="display: none">
                    <div class="layui-inline">
                        <label class="layui-form-label" >常见故障</label>
                        <div class="layui-input-block faults-wrapper" id="faults-wrapper"></div>
                    </div>
                </div>
                <!-- 其他故障 -->
                <div class="layui-form-item">
                    <div class="layui-inline">
                        <label class="layui-form-label">其他故障</label>
                        <div class="layui-input-inline textarea-new-order">
                            <textarea id="fault-remark" name="faultRemark" placeholder="最长不能超300个字" class="layui-textarea" maxlength="300" lay-verify="maxLenTo300"></textarea>
                        </div>
                    </div>
                </div>
                <!-- 会员权益 -->
                <div class="layui-form-item">
                    <div class="layui-inline">
                        <label class="layui-form-label">会员权益</label>
                        <div class="layui-input-inline" style="width: 725px;">
                            <input type="radio"
                                   id = "equityType"
                                   name="equityType"
                                   disabled
                                   th:each="item : ${memberEquityList}"
                                   th:value="${item.value}"
                                   th:title="${item.text}"
                                   lay-verify="required"
                                   lay-filter="member-equity">
                        </div>
                    </div>
                </div>
                <!-- 用户地址-省、市 -->
                <div class="layui-form-item">
                    <div class="layui-inline">
                        <label class="layui-form-label">用户地址</label>
                        <div class="layui-input-inline" style="width: 200px;">
                            <select id="provinceId" name="provinceId" lay-verify="required" lay-filter="province" lay-search disabled>
                                <option value="">省</option>
                                <option value="500000">重庆</option>
                                <option th:each="province : ${provinceList}" th:value="${province.value}" th:text="${province.text}"></option>
                            </select>
                        </div>
                        <div class="layui-input-inline select-city">
                            <select id="cityId" name="cityId" lay-verify="required" lay-filter="city" lay-search disabled>
                                <option value="">市</option>
                                <option value="500100">重庆</option>
                                <option th:each="city : ${cityList}" th:value="${city.value}" th:text="${city.text}"></option>
                            </select>
                        </div>
                        <label class="layui-form-label" style="width: 56px; text-align: left">子公司：</label>
                        <div class="layui-input-inline" style="width: 50px;">
                            <div id="company" class="company"></div>
                        </div>
                    </div>
                </div>
                <!-- 服务区域 -->
                <!--<div id="service-area" class="layui-form-item service-area" style="display: none">-->
                    <!--<label class="layui-form-label">服务区域</label>-->
                    <!--<div class="layui-input-inline" id="area-list"  style="width: 515px;">-->
                    <!--</div>-->
                    <!--<div class="layui-input-inline layui-word-aux" style="width: 200px; font-size: 12px;padding: 4px 0!important">-->
                        <!--绿色：可服务；<br>-->
                        <!--灰色：不可服务；<br>-->
                        <!--红色：当前地址所在区-->
                    <!--</div>-->
                <!--</div>-->
                <!-- 用户地址-map -->
                <div class="layui-form-item">
                    <div class="layui-inline">
                        <label class="layui-form-label" ></label>
                        <div class="layui-input-inline input-large" id="street-wrapper">
                            <input class="layui-input layui-disabled"
                                   id="customerAddress"
                                   type="text"
                                   name="street"
                                   lay-verify="required"
                                   placeholder="搜索地点，选择小区，街道，大厦..."
                                   autocomplete="off"
                                   style="padding-right: 95px;"
                                   readonly>
                            <!--搜索建议-->
                            <button id="btn-map" class="layui-btn layui-btn-normal layui-hide" style="position: absolute;top: 0;right: 0;">百度地图</button>
                            <div id="suggestPanel" class="suggestPanelBox layui-anim layui-anim-upbit">
                                <ul></ul>
                            </div>
                        </div>
                        <div class="layui-inline">
                            <div class="layui-input-inline" id="county-list">
                            </div>
                        </div>
                    </div>
                </div>
                <!-- 用户地址-门牌 -->
                <div class="layui-form-item">
                    <div class="layui-inline">
                        <label class="layui-form-label"></label>
                        <div class="layui-input-inline input-large">
                            <input class="layui-input layui-disabled"
                                   type="text"
                                   name="address"
                                   maxlength="100"
                                   placeholder="请输入详细楼栋、门牌号"
                                   autocomplete="off"
                                   lay-verify="required"
                                   readonly>
                        </div>
                    </div>
                </div>
                <!-- 应付总价 -->
                <div class="layui-form-item" id="amount-wrapper" style="display: none;">
                    <div class="layui-inline">
                        <label class="layui-form-label">应付总价</label>
                        <div class="layui-input-inline layui-inline-text" id="amount-clean" style="width: 725px;display: none;">
                            <span id="amount" style="color: red;"></span>元
                            <button class="layui-btn" style="padding: 0;"></button>
                        </div>
                        <div class="layui-input-inline layui-inline-text" id="amount-others">
                            <span>上门检测后确定</span>
                            <a class="btn-duty-time" id="btn-price-table" href="javascript:void(0);">查看价格表</a>
                            <button class="layui-btn" style="padding: 0;"></button>
                        </div>
                    </div>
                </div>
                <!-- 预约时间 -->
                <div class="layui-form-item duty-time-item">
                    <div class="layui-inline">
                        <label class="layui-form-label">预约时间</label>
                        <div class="layui-input-inline layui-inline-text" id="duty-time-wrapper">
                            <span id="duty-time" th:text="${dutyTime}"></span>
                            <a class="btn-duty-time" id="btn-duty-time" href="javascript:void(0);">选择预约时间</a>
                            <button class="layui-btn" style="padding: 0;"></button>
                            <input id="duty-time-input"
                                   type="hidden"
                                   name="dutyTime"
                                   th:value="${dutyTime}"
                                   lay-verify="dutyTime"
                                   style="padding: 0;">
                        </div>
                        <div class="layui-input-inline">
                            <input id="duty-time-checkbox"
                                   type="checkbox"
                                   name=""
                                   lay-filter="duty-time-checkbox"
                                   title="客户不确定上门时间"
                                   lay-skin="primary">
                        </div>
                    </div>
                </div>
                <!-- 下单备注 -->
                <div class="layui-form-item">
                    <div class="layui-inline">
                        <label class="layui-form-label">下单备注</label>
                        <div class="layui-input-inline textarea-new-order">
                            <textarea class="layui-textarea"
                                      name="remark"
                                      maxlength="500"
                                      placeholder="最长不能超500个字"
                                      lay-verify="maxLenTo500"></textarea>
                        </div>
                    </div>
                </div>
                <!-- 按钮 -->
                <div class="layui-form-item">
                    <label class="layui-form-label"></label>
                    <div class="layui-input-block">
                        <div>
                            <button id="confirmbtn" type="submit" class="layui-btn" lay-submit lay-filter="confirmbtn">保存</button>
                            <!--<button type="reset" class="layui-btn layui-btn-primary" >重置</button>-->
                        </div>
                    </div>
                </div>
                <div style="height: 1px"></div>
            </div>
        </form>
    </div>
</div>

<!-- 会员权益 -->
<script id="tpl-panel-equity" type="text/html">
    <div id="panel-equity" style="padding: 20px; background-color: #F2F2F2;">
        <div class="layui-row layui-col-space15">
            {{#  layui.each(d.memOrderEquityList, function(index, item){ }}
            <div class="layui-col-md12">
                <div class="layui-card">
                    <div class="layui-card-header" style="padding: 10px 15px; height: auto; line-height: 25px;">
                        {{#  if(item.equityType == 1){ }}
                            <p>会员产品：{{d.memProductName}}</p>
                            <p>会员有效期：{{d.effectTime}}-{{d.expiredTime}}</p>
                            <p>原单产品：{{d.workProductName}}</p>
                        {{#  } }}
                    </div>
                    <div class="layui-card-body">
                        <div>会员权益</div>
                        <div>
                            权益：
                            {{#  if(item.equityType == 1){ }}
                                {{item.equityTypeName}}，
                                享有：{{layui.NP.formatMoneyToYuan(item.buyReductionValue)}} 额度
                            {{#  } }}
                            {{#  if(item.equityType == 3){ }}
                                {{item.equityTypeName}}，
                                赠送次数：{{item.buyGivNum}} ，
                                剩余：{{item.givNum}}次
                            {{#  } }}
                            {{#  if(item.equityType == 4){ }}
                                {{item.equityTypeName}}，
                                折扣：{{item.discountValue/10}}折
                            {{#  } }}
                            {{#  if(item.equityType == 5){ }}
                                {{item.equityTypeName}}，
                                {{item.title}}
                            {{#  } }}
                        </div>
                    </div>
                </div>
            </div>
            {{#  }); }}
            {{#  if(d.equityList === 0){ }}
            无数据
            {{#  } }}
        </div>
        <div class="layui-row layui-col-space15">
            <div class="layui-col-md12">
                <div class="layui-card">
                    <div class="layui-card-header">
                        权益使用
                    </div>
                    <div class="layui-card-body">
                        {{#  layui.each(d.userEquityInfoList, function(index, item){ }}
                            <p> {{item}} </p>
                        {{#  }); }}
                    </div>
                </div>
            </div>
         </div>
    </div>
</script>

<th:block th:replace="common/_orderAddTmpl :: common_variable"/>

<script type="text/javascript" th:inline="javascript">
    layui.config({
        base: "/static/js/module/",
        version: 20221013001
    }).extend({
        oms_mermber_order_add: "member/order/zmn.oms.mermber.order.add"
    }).use(['index', 'oms_mermber_order_add']);
</script>
</body>
</html>